import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * 对于Lambda的一些练习
 * User: xwl
 * Date: 2023-06-04
 * Time: 19:30
 */
public class Test3 {
    public static void main(String[] args) {
        Map<String, Integer> hashMap = new HashMap<>();
        hashMap.put("hello", 3);
        hashMap.put("abc", 2);
        hashMap.put("this", 1);
        hashMap.forEach(new BiConsumer<String, Integer>() {
            @Override
            public void accept(String s, Integer integer) {
                System.out.println("key:" + s + "val:" + integer);
            }
        });
        hashMap.forEach((String s, Integer integer) -> System.out.println("key:" + s + "val:" + integer));
    }
}
